const router = require("express").Router();
const {
  groupDegree,
  groupSalary,
  groupCity,
  groupSkills,
  groupCitySkills,
  groupCityDegree,
  groupCitySalary,
} = require("../services/dashboard");

/**
 * 学历分布
 */
router.get("/job_degree", async (req, res) => {
  const data = await groupDegree();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 薪资范围，在两百以上的
 */
router.get("/salary", async (req, res) => {
  const data = await groupSalary();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 城市分布
 */
router.get("/city", async (req, res) => {
  const data = await groupCity();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 技能关键词
 */
router.get("/skills", async (req, res) => {
  const data = await groupSkills();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 城市技能数据
 */
router.get("/city_skills", async (req, res) => {
  const data = await groupCitySkills();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 城市学历数据
 */
router.get("/city_degrees", async (req, res) => {
  const data = await groupCityDegree();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});

/**
 * 城市薪资
 */
router.get("/city_salary", async (req, res) => {
  const data = await groupCitySalary();
  res.json({
    code: 1,
    total: data.length,
    data,
  });
});
module.exports = router;
